import random

import pygame

width=720
height=1280

# 设置窗口尺寸
class Gold(pygame.sprite.Sprite):
    def __init__(self, dims, size, img, score):
        super().__init__()
        self.dims = dims
        self.score = score
        self.width, self.height = dims
        self.image = pygame.transform.scale(img,size)
        # self.spriteScale = pygame.transform.scale(self.image, (50, 50))
        # self.image.fill((random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)))
        self.rect = self.image.get_rect()

        self.rect.center = (random.randint(0, self.width), random.randint(0,300))
        self.speed_y = random.randint(4, 10)

    def update(self):
        self.rect.y += self.speed_y
        if self.rect.y+100>self.height:
            return True
